var a = require("../../../mycomponent/yz_pay/yz_pay"), e = getApp();

Page({
    behaviors: [ a ],
    data: {
        language: "",
        val: "",
        recharge_val: "",
        alipay_show: !1,
        wechat_show: !1,
        pay_type: "",
        buttons: {}
    },
    onLoad: function(a) {
        this.getData();
    },
    onReady: function() {
        var a = wx.getStorageSync("langIndex");
        this.setData({
            language: a.en
        });
    },
    onShow: function() {},
    onShareAppMessage: function() {},
    getData: function() {
        var a = this, t = e.getNetAddresss("plugin.froze.Frontend.Controllers.page.index");
        e._getNetWork({
            url: t,
            success: function(e) {
                var t = e.data;
                1 === t.result && (a.setData({
                    val: t.data.froze,
                    every_value: t.data.recharge_rate_money,
                    transform_value: t.data.recharge_rate_love
                }), t.data.buttons.map(function(e) {
                    28 == e.value && a.setData({
                        buttons: e
                    });
                }));
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    rechargeHandel: function(a) {
        var t = this;
        if (this.setData({
            pay_type: a.target.dataset.index
        }), this.data.recharge_val) {
            var n = e.getNetAddresss("plugin.froze.Frontend.Modules.Froze.Controllers.recharge.index");
            n += "&pay_way=" + this.data.pay_type, n += "&change_value=" + this.data.recharge_val, 
            n += "&client_type=2", e._getNetWork({
                url: n,
                success: function(a) {
                    1 === a.data.result ? t.rechargePay(t.data.pay_type, a.data, a.data.ordersn) : wx.showToast({
                        title: a.data.msg,
                        icon: "none",
                        image: "",
                        duration: 1500,
                        mask: !1
                    });
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        } else wx.showToast({
            title: "充值数量不能为空",
            icon: "none",
            duration: 1500
        });
    },
    onChange: function(a) {
        this.setData({
            recharge_val: a.detail
        });
    }
});